package com.example.rocketmq.base.provider;

import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.common.message.Message;

/**
 * 单向消息
 * 用于不关心发送结果的场景，例如日志
 */
public class OnewayProducer {
    public static void main(String[] args) throws Exception {
        DefaultMQProducer producer = new DefaultMQProducer("test_group");
        producer.setNamesrvAddr("192.168.228.101:9876");
        producer.start();
        Message msg = new Message("base", "oneway", "hello world".getBytes());
        producer.sendOneway(msg);
        producer.shutdown();
    }
}
